<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/templates/common/taglib.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>大连大学附属中山医院</title>
<script type="text/javascript" src="${basePath}/static/publics/assets/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="${basePath}/static/publics/assets/jqPaginator/jqPaginator.js"></script>
</head>
<body>
    <div class="list_NR">
       <div class="loc">
            <h3>踪迹查询</h3>
            <ul class="loc_loc">病案示踪 > 踪迹查询
            </ul>
        </div>
        <div class="list_con_table">
          <input type="hidden" value="${medTraceQuery.totalCounts }" id="totalCountsHidden">
        <form action="${basePath}/statis/showMedTraceQuery" method="get" id="queryForm">
         	<input type="hidden" name="currentPage" value="${medTraceQuery.currentPage }" id="currentPageHidden">
	        	<input type="hidden" name="pageSize" value="${medTraceQuery.pageSize }" id="pageSizeHidden">
          <div class="search_table">
                <ul class="clearfix" style="margin-bottom:0;">
				    <li class="Label_1" style="width:12%">身份证号：&nbsp;</li>
				    <li class="Label_2" style="width:17%"><input class="input_box" type="text" name='idCard' value="${medTraceQuery.idCard }"/></li>
					<li class="Label_1" style="width:12%">识别码：&nbsp;</li>
				    <li class="Label_2" style="width:17%"><input class="input_box"  type="text" name="mrId" value="${medTraceQuery.mrId }" /></li>
				    <li class="Label_1" style="width:12%">记录日期：&nbsp;</li>
                      <li class="Label_2" style="width:30%">
                    	<input class="input_box" style="width:45%;" type="text" name="traceStartDate" value='<fmt:formatDate value="${medTraceQuery.traceStartDate}" pattern="yyyy-MM-dd"/>' onFocus="WdatePicker()" />
                    	-
                    	<input class="input_box" type="text" style="width:45%;" name="traceEndDate" value='<fmt:formatDate value="${medTraceQuery.traceEndDate}" pattern="yyyy-MM-dd"/>' onFocus="WdatePicker()" />
                    </li>
				    <li class="Label_1" style="width:12%">病案号：&nbsp;</li>
				    <li class="Label_2" style="width:17%"><input class="input_box"  type="text" name="onlyId" value="${medTraceQuery.onlyId}" /></li>
				    <li class="Label_1" style="width:12%">姓名：&nbsp;</li>
				    <li class="Label_2"  style="width:17%"><input class="input_box" type="text" name="name" value="${medTraceQuery.name }" /></li>
                	
                   <li class="Label_1" style="width:12%">病案踪迹：&nbsp;</li>
				    <li class="Label_2" style="width:17%">
				    	<select class="input_box" name="traceTypeId" id="traceTypeId">
					  		<option value="">请选择</option>
					  		<c:forEach var="traceType" items="${traceTypes }">
					  			<c:choose>
					  				<c:when test="${medTraceQuery.traceTypeId==traceType.id}">
					  					<option value="${traceType.id}"  selected="selected">${traceType.name }</option>
					  				</c:when>
					  				<c:otherwise>
					  					<option value="${traceType.id}">${traceType.name }</option>
					  				</c:otherwise>
					  			</c:choose>
					  		</c:forEach>
						</select>
					
					</li>
					<%--  <li class="Label_1">病案号：&nbsp;</li>
				    <li class="Label_2" ><input class="input_box" type="text" name='onlyId' value="${medTraceQuery.onlyId }"/></li> --%>
                    <li class="Label_5">
                        <div class="right" style="text-align:right">
                            <a id="Add" onclick="queryFormSubmit()">查询</a>
                        </div>
                    </li>  
                </ul>
                </div>
        </form>
        
        <form action="${basePath}/statis/showMedTraceQuery" method="get" id="pageForm">
	        	<input type="hidden" name="currentPage" value="${medTraceQuery.currentPage }" id="currentPageHid">
	        	<input type="hidden" name="pageSize" value="${medTraceQuery.pageSize }" id="pageSizeHid">
	        	<input type="hidden" name="onlyId" value="${medTraceQuery.onlyId}">
	        	<input type="hidden" name="name" value="${medTraceQuery.name }">
	        	<input type="hidden" name="idCard" value="${medTraceQuery.idCard }">
	        	<input type="hidden" name="mrId" value="${medTraceQuery.mrId }">
	        	<input type="hidden" name="traceStartDate" value="<fmt:formatDate value="${medTraceQuery.traceStartDate}" pattern="yyyy-MM-dd"/>">
	        	<input type="hidden" name="traceEndDate" value="<fmt:formatDate value="${medTraceQuery.traceEndDate}" pattern="yyyy-MM-dd"/>">
	        	<input type="hidden" name="traceTypeId" value="${medTraceQuery.traceTypeId}">
	        	
	        </form> 
        </div>
             <table class="Search_tableList" border-collapse:collapse;" cellpadding="0" cellspacing="0">
                <tr>		
                	<td class="tdLabel_4" style="display:none">编号</td>
             		<td class="tdLabel_4">身份证号</td>
                    <td class="tdLabel_4">识别码</td>
                    <td class="tdLabel_4">姓名</td>
                    <td class="tdLabel_4">记录日期</td>
                    <td class="tdLabel_4">病案踪迹</td>
                    <td class="tdLabel_4">操作者</td>
                </tr>
                
                <tbody id="tbody">
 					<c:forEach var="medTrace" items="${treatmentTraces }">
 						<tr>
 							<td class="tdLabel_5" style="display:none">${medTrace.id }</td>
 							<td class="tdLabel_5">${medTrace.id_cards }</td>
 							<td class="tdLabel_5">${medTrace.mr_id }</td>
 							<td class="tdLabel_5">${medTrace.patient_name }</td>
 							<td class="tdLabel_5"><fmt:formatDate value="${medTrace.trace_date }" pattern="yyyy-MM-dd"/></td>
 							<td class="tdLabel_5">${medTrace.trace_type_name }</td>
 							<td class="tdLabel_5">${medTrace.user_id }</td>
 						</tr>
 					</c:forEach>
                </tbody>
            </table>
              <div class="pageList">
           		 <ul class="pagination clearfix" id="page_plus"></ul>
           		 <div class="pagination">
               		 <div>总共：<b id="totalPage">0</b> 条信息    当前页是第 <b id="currentPage">0/0</b>　页</div>
           		 </div>
       		 </div>
        </div>
</body>
<!--JS部分-->
<script type="text/javascript">
	function queryFormSubmit(){
		$("#queryForm").submit();
	}
	
	$(function(){
		var totalCounts = $("#totalCountsHidden").val();
		var pageSize = $("#pageSizeHidden").val();
		var currentPage = $("#currentPageHidden").val();
		initPage(parseInt(totalCounts),parseInt(pageSize),parseInt(currentPage));
	});

	function initPage(totalCounts,pageSize,currentPage){
		 var visiblePages = 5;
		 var totalPages =  totalCounts%pageSize==0?(totalCounts/pageSize):(parseInt(totalCounts/pageSize)+1);
		 $('#page_plus').jqPaginator({

		        totalCounts: totalCounts,
		        pageSize:pageSize,
		        visiblePages: visiblePages,
		        currentPage: currentPage,

		        first:'<li class="first"><a href="javascript:void(0);">首页</a></li>',
		        prev: '<li class="prev"><a href="javascript:void(0);">上一页</a></li>',
		        next: '<li class="next"><a href="javascript:void(0);">下一页</a></li>',
		        last: '<li class="last"><a href="javascript:void(0);">末页</a></li>',
		        page: '<li class="page"><a href="javascript:void(0);">{{page}}</a></li>',
		        onPageChange: function (num,type) {

		     		if(type !='init'){
		     			$("#currentPageHid").val(num);
		     			$("#currentPageHidden").val(num);
						$("#pageSizeHid").val(pageSize);
						$("#pageSizeHidden").val(pageSize);
						$("#pageForm").submit();
					}
		            $("#totalPage").html(totalCounts);
		            $("#currentPage").html(num+"/"+totalPages);
		            $("#currentPageHidden").val(currentPage);
				    $("#pageSizeHidden").val(pageSize);
		        }
		    });

	}
</script>
</html>